//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS CloudControl service.
///
/// For more information about Amazon Web Services Cloud Control API, see the Amazon Web Services Cloud Control API User Guide.
public struct CloudControl: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the CloudControl client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            amzTarget: "CloudApiService",
            serviceName: "CloudControl",
            serviceIdentifier: "cloudcontrolapi",
            serviceProtocol: .json(version: "1.0"),
            apiVersion: "2021-09-30",
            endpoint: endpoint,
            variantEndpoints: Self.variantEndpoints,
            errorType: CloudControlErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }




    /// FIPS and dualstack endpoints
    static var variantEndpoints: [EndpointVariantType: AWSServiceConfig.EndpointVariant] {[
        [.dualstack]: .init(endpoints: [
            "af-south-1": "cloudcontrolapi.af-south-1.api.aws",
            "ap-east-1": "cloudcontrolapi.ap-east-1.api.aws",
            "ap-northeast-1": "cloudcontrolapi.ap-northeast-1.api.aws",
            "ap-northeast-2": "cloudcontrolapi.ap-northeast-2.api.aws",
            "ap-northeast-3": "cloudcontrolapi.ap-northeast-3.api.aws",
            "ap-south-1": "cloudcontrolapi.ap-south-1.api.aws",
            "ap-south-2": "cloudcontrolapi.ap-south-2.api.aws",
            "ap-southeast-1": "cloudcontrolapi.ap-southeast-1.api.aws",
            "ap-southeast-2": "cloudcontrolapi.ap-southeast-2.api.aws",
            "ap-southeast-3": "cloudcontrolapi.ap-southeast-3.api.aws",
            "ap-southeast-4": "cloudcontrolapi.ap-southeast-4.api.aws",
            "ap-southeast-5": "cloudcontrolapi.ap-southeast-5.api.aws",
            "ap-southeast-7": "cloudcontrolapi.ap-southeast-7.api.aws",
            "ca-central-1": "cloudcontrolapi.ca-central-1.api.aws",
            "ca-west-1": "cloudcontrolapi.ca-west-1.api.aws",
            "cn-north-1": "cloudcontrolapi.cn-north-1.api.amazonwebservices.com.cn",
            "cn-northwest-1": "cloudcontrolapi.cn-northwest-1.api.amazonwebservices.com.cn",
            "eu-central-1": "cloudcontrolapi.eu-central-1.api.aws",
            "eu-central-2": "cloudcontrolapi.eu-central-2.api.aws",
            "eu-north-1": "cloudcontrolapi.eu-north-1.api.aws",
            "eu-south-1": "cloudcontrolapi.eu-south-1.api.aws",
            "eu-south-2": "cloudcontrolapi.eu-south-2.api.aws",
            "eu-west-1": "cloudcontrolapi.eu-west-1.api.aws",
            "eu-west-2": "cloudcontrolapi.eu-west-2.api.aws",
            "eu-west-3": "cloudcontrolapi.eu-west-3.api.aws",
            "il-central-1": "cloudcontrolapi.il-central-1.api.aws",
            "me-central-1": "cloudcontrolapi.me-central-1.api.aws",
            "me-south-1": "cloudcontrolapi.me-south-1.api.aws",
            "mx-central-1": "cloudcontrolapi.mx-central-1.api.aws",
            "sa-east-1": "cloudcontrolapi.sa-east-1.api.aws",
            "us-east-1": "cloudcontrolapi.us-east-1.api.aws",
            "us-east-2": "cloudcontrolapi.us-east-2.api.aws",
            "us-gov-east-1": "cloudcontrolapi.us-gov-east-1.api.aws",
            "us-gov-west-1": "cloudcontrolapi.us-gov-west-1.api.aws",
            "us-west-1": "cloudcontrolapi.us-west-1.api.aws",
            "us-west-2": "cloudcontrolapi.us-west-2.api.aws"
        ]),
        [.dualstack, .fips]: .init(endpoints: [
            "ca-central-1": "cloudcontrolapi-fips.ca-central-1.api.aws",
            "ca-west-1": "cloudcontrolapi-fips.ca-west-1.api.aws",
            "us-east-1": "cloudcontrolapi-fips.us-east-1.api.aws",
            "us-east-2": "cloudcontrolapi-fips.us-east-2.api.aws",
            "us-gov-east-1": "cloudcontrolapi-fips.us-gov-east-1.api.aws",
            "us-gov-west-1": "cloudcontrolapi-fips.us-gov-west-1.api.aws",
            "us-west-1": "cloudcontrolapi-fips.us-west-1.api.aws",
            "us-west-2": "cloudcontrolapi-fips.us-west-2.api.aws"
        ]),
        [.fips]: .init(endpoints: [
            "ca-central-1": "cloudcontrolapi-fips.ca-central-1.amazonaws.com",
            "ca-west-1": "cloudcontrolapi-fips.ca-west-1.amazonaws.com",
            "us-east-1": "cloudcontrolapi-fips.us-east-1.amazonaws.com",
            "us-east-2": "cloudcontrolapi-fips.us-east-2.amazonaws.com",
            "us-gov-east-1": "cloudcontrolapi-fips.us-gov-east-1.amazonaws.com",
            "us-gov-west-1": "cloudcontrolapi-fips.us-gov-west-1.amazonaws.com",
            "us-west-1": "cloudcontrolapi-fips.us-west-1.amazonaws.com",
            "us-west-2": "cloudcontrolapi-fips.us-west-2.amazonaws.com"
        ])
    ]}

    // MARK: API Calls

    /// Cancels the specified resource operation request. For more information, see Canceling resource operation requests in the Amazon Web Services Cloud Control API User Guide. Only resource operations requests with a status of PENDING or IN_PROGRESS can be canceled.
    @Sendable
    @inlinable
    public func cancelResourceRequest(_ input: CancelResourceRequestInput, logger: Logger = AWSClient.loggingDisabled) async throws -> CancelResourceRequestOutput {
        try await self.client.execute(
            operation: "CancelResourceRequest", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Cancels the specified resource operation request. For more information, see Canceling resource operation requests in the Amazon Web Services Cloud Control API User Guide. Only resource operations requests with a status of PENDING or IN_PROGRESS can be canceled.
    ///
    /// Parameters:
    ///   - requestToken: The RequestToken of the ProgressEvent object returned by the resource operation request.
    ///   - logger: Logger use during operation
    @inlinable
    public func cancelResourceRequest(
        requestToken: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CancelResourceRequestOutput {
        let input = CancelResourceRequestInput(
            requestToken: requestToken
        )
        return try await self.cancelResourceRequest(input, logger: logger)
    }

    /// Creates the specified resource. For more information, see Creating a resource in the Amazon Web Services Cloud Control API User Guide. After you have initiated a resource creation request, you can monitor the progress of your request by calling GetResourceRequestStatus using the RequestToken of the ProgressEvent type returned by CreateResource.
    @Sendable
    @inlinable
    public func createResource(_ input: CreateResourceInput, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateResourceOutput {
        try await self.client.execute(
            operation: "CreateResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates the specified resource. For more information, see Creating a resource in the Amazon Web Services Cloud Control API User Guide. After you have initiated a resource creation request, you can monitor the progress of your request by calling GetResourceRequestStatus using the RequestToken of the ProgressEvent type returned by CreateResource.
    ///
    /// Parameters:
    ///   - clientToken: A unique identifier to ensure the idempotency of the resource request. As a best practice, specify this token to ensure idempotency, so that Amazon Web Services Cloud Control API can accurately distinguish between request retries and new resource requests. You might retry a resource request to ensure that it was successfully received. A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. For more information, see Ensuring resource operation requests are unique in the Amazon Web Services Cloud Control API User Guide.
    ///   - desiredState: Structured data format representing the desired state of the resource, consisting of that resource's properties and their desired values.  Cloud Control API currently supports JSON as a structured data format.  Specify the desired state as one of the following:   A JSON blob   A local path containing the desired state in JSON data format   For more information, see Composing the desired state of the resource in the Amazon Web Services Cloud Control API User Guide. For more information about the properties of a specific resource, refer to the related topic for the resource in the Resource and property types reference in the CloudFormation Users Guide.
    ///   - roleArn: The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the  handlers  section of the resource type definition schema. If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials. For more information, see Specifying credentials in the Amazon Web Services Cloud Control API User Guide.
    ///   - typeName: The name of the resource type.
    ///   - typeVersionId: For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.
    ///   - logger: Logger use during operation
    @inlinable
    public func createResource(
        clientToken: String? = CreateResourceInput.idempotencyToken(),
        desiredState: String,
        roleArn: String? = nil,
        typeName: String,
        typeVersionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateResourceOutput {
        let input = CreateResourceInput(
            clientToken: clientToken, 
            desiredState: desiredState, 
            roleArn: roleArn, 
            typeName: typeName, 
            typeVersionId: typeVersionId
        )
        return try await self.createResource(input, logger: logger)
    }

    /// Deletes the specified resource. For details, see Deleting a resource in the Amazon Web Services Cloud Control API User Guide. After you have initiated a resource deletion request, you can monitor the progress of your request by calling GetResourceRequestStatus using the RequestToken of the ProgressEvent returned by DeleteResource.
    @Sendable
    @inlinable
    public func deleteResource(_ input: DeleteResourceInput, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteResourceOutput {
        try await self.client.execute(
            operation: "DeleteResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes the specified resource. For details, see Deleting a resource in the Amazon Web Services Cloud Control API User Guide. After you have initiated a resource deletion request, you can monitor the progress of your request by calling GetResourceRequestStatus using the RequestToken of the ProgressEvent returned by DeleteResource.
    ///
    /// Parameters:
    ///   - clientToken: A unique identifier to ensure the idempotency of the resource request. As a best practice, specify this token to ensure idempotency, so that Amazon Web Services Cloud Control API can accurately distinguish between request retries and new resource requests. You might retry a resource request to ensure that it was successfully received. A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. For more information, see Ensuring resource operation requests are unique in the Amazon Web Services Cloud Control API User Guide.
    ///   - identifier: The identifier for the resource. You can specify the primary identifier, or any secondary identifier defined for the resource type in its resource schema. You can only specify one identifier. Primary identifiers can be specified as a string or JSON; secondary identifiers must be specified as JSON. For compound primary identifiers (that is, one that consists of multiple resource properties strung together), to specify the primary identifier as a string, list the property values in the order they are specified in the primary identifier definition, separated by |. For more information, see Identifying resources in the Amazon Web Services Cloud Control API User Guide.
    ///   - roleArn: The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the  handlers  section of the resource type definition schema. If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials. For more information, see Specifying credentials in the Amazon Web Services Cloud Control API User Guide.
    ///   - typeName: The name of the resource type.
    ///   - typeVersionId: For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteResource(
        clientToken: String? = DeleteResourceInput.idempotencyToken(),
        identifier: String,
        roleArn: String? = nil,
        typeName: String,
        typeVersionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteResourceOutput {
        let input = DeleteResourceInput(
            clientToken: clientToken, 
            identifier: identifier, 
            roleArn: roleArn, 
            typeName: typeName, 
            typeVersionId: typeVersionId
        )
        return try await self.deleteResource(input, logger: logger)
    }

    /// Returns information about the current state of the specified resource. For details, see Reading a resource's current state. You can use this action to return information about an existing resource in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.
    @Sendable
    @inlinable
    public func getResource(_ input: GetResourceInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetResourceOutput {
        try await self.client.execute(
            operation: "GetResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns information about the current state of the specified resource. For details, see Reading a resource's current state. You can use this action to return information about an existing resource in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.
    ///
    /// Parameters:
    ///   - identifier: The identifier for the resource. You can specify the primary identifier, or any secondary identifier defined for the resource type in its resource schema. You can only specify one identifier. Primary identifiers can be specified as a string or JSON; secondary identifiers must be specified as JSON. For compound primary identifiers (that is, one that consists of multiple resource properties strung together), to specify the primary identifier as a string, list the property values in the order they are specified in the primary identifier definition, separated by |. For more information, see Identifying resources in the Amazon Web Services Cloud Control API User Guide.
    ///   - roleArn: The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the  handlers  section of the resource type definition schema. If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials. For more information, see Specifying credentials in the Amazon Web Services Cloud Control API User Guide.
    ///   - typeName: The name of the resource type.
    ///   - typeVersionId: For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.
    ///   - logger: Logger use during operation
    @inlinable
    public func getResource(
        identifier: String,
        roleArn: String? = nil,
        typeName: String,
        typeVersionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetResourceOutput {
        let input = GetResourceInput(
            identifier: identifier, 
            roleArn: roleArn, 
            typeName: typeName, 
            typeVersionId: typeVersionId
        )
        return try await self.getResource(input, logger: logger)
    }

    /// Returns the current status of a resource operation request. For more information, see Tracking the progress of resource operation requests in the Amazon Web Services Cloud Control API User Guide.
    @Sendable
    @inlinable
    public func getResourceRequestStatus(_ input: GetResourceRequestStatusInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetResourceRequestStatusOutput {
        try await self.client.execute(
            operation: "GetResourceRequestStatus", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns the current status of a resource operation request. For more information, see Tracking the progress of resource operation requests in the Amazon Web Services Cloud Control API User Guide.
    ///
    /// Parameters:
    ///   - requestToken: A unique token used to track the progress of the resource operation request. Request tokens are included in the ProgressEvent type returned by a resource operation request.
    ///   - logger: Logger use during operation
    @inlinable
    public func getResourceRequestStatus(
        requestToken: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetResourceRequestStatusOutput {
        let input = GetResourceRequestStatusInput(
            requestToken: requestToken
        )
        return try await self.getResourceRequestStatus(input, logger: logger)
    }

    /// Returns existing resource operation requests. This includes requests of all status types. For more information, see Listing active resource operation requests in the Amazon Web Services Cloud Control API User Guide.  Resource operation requests expire after 7 days.
    @Sendable
    @inlinable
    public func listResourceRequests(_ input: ListResourceRequestsInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListResourceRequestsOutput {
        try await self.client.execute(
            operation: "ListResourceRequests", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns existing resource operation requests. This includes requests of all status types. For more information, see Listing active resource operation requests in the Amazon Web Services Cloud Control API User Guide.  Resource operation requests expire after 7 days.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results. The default is 20.
    ///   - nextToken: If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
    ///   - resourceRequestStatusFilter: The filter criteria to apply to the requests returned.
    ///   - logger: Logger use during operation
    @inlinable
    public func listResourceRequests(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        resourceRequestStatusFilter: ResourceRequestStatusFilter? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListResourceRequestsOutput {
        let input = ListResourceRequestsInput(
            maxResults: maxResults, 
            nextToken: nextToken, 
            resourceRequestStatusFilter: resourceRequestStatusFilter
        )
        return try await self.listResourceRequests(input, logger: logger)
    }

    /// Returns information about the specified resources. For more information, see Discovering resources in the Amazon Web Services Cloud Control API User Guide. You can use this action to return information about existing resources in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.
    @Sendable
    @inlinable
    public func listResources(_ input: ListResourcesInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListResourcesOutput {
        try await self.client.execute(
            operation: "ListResources", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns information about the specified resources. For more information, see Discovering resources in the Amazon Web Services Cloud Control API User Guide. You can use this action to return information about existing resources in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.
    ///
    /// Parameters:
    ///   - maxResults: Reserved.
    ///   - nextToken: If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.
    ///   - resourceModel: The resource model to use to select the resources to return.
    ///   - roleArn: The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the  handlers  section of the resource type definition schema. If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials. For more information, see Specifying credentials in the Amazon Web Services Cloud Control API User Guide.
    ///   - typeName: The name of the resource type.
    ///   - typeVersionId: For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.
    ///   - logger: Logger use during operation
    @inlinable
    public func listResources(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        resourceModel: String? = nil,
        roleArn: String? = nil,
        typeName: String,
        typeVersionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListResourcesOutput {
        let input = ListResourcesInput(
            maxResults: maxResults, 
            nextToken: nextToken, 
            resourceModel: resourceModel, 
            roleArn: roleArn, 
            typeName: typeName, 
            typeVersionId: typeVersionId
        )
        return try await self.listResources(input, logger: logger)
    }

    /// Updates the specified property values in the resource. You specify your resource property updates as a list of patch operations contained in a JSON patch document that adheres to the  RFC 6902 - JavaScript Object Notation (JSON) Patch standard. For details on how Cloud Control API performs resource update operations, see Updating a resource in the Amazon Web Services Cloud Control API User Guide. After you have initiated a resource update request, you can monitor the progress of your request by calling GetResourceRequestStatus using the RequestToken of the ProgressEvent returned by UpdateResource. For more information about the properties of a specific resource, refer to the related topic for the resource in the Resource and property types reference in the CloudFormation Users Guide.
    @Sendable
    @inlinable
    public func updateResource(_ input: UpdateResourceInput, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateResourceOutput {
        try await self.client.execute(
            operation: "UpdateResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates the specified property values in the resource. You specify your resource property updates as a list of patch operations contained in a JSON patch document that adheres to the  RFC 6902 - JavaScript Object Notation (JSON) Patch standard. For details on how Cloud Control API performs resource update operations, see Updating a resource in the Amazon Web Services Cloud Control API User Guide. After you have initiated a resource update request, you can monitor the progress of your request by calling GetResourceRequestStatus using the RequestToken of the ProgressEvent returned by UpdateResource. For more information about the properties of a specific resource, refer to the related topic for the resource in the Resource and property types reference in the CloudFormation Users Guide.
    ///
    /// Parameters:
    ///   - clientToken: A unique identifier to ensure the idempotency of the resource request. As a best practice, specify this token to ensure idempotency, so that Amazon Web Services Cloud Control API can accurately distinguish between request retries and new resource requests. You might retry a resource request to ensure that it was successfully received. A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. For more information, see Ensuring resource operation requests are unique in the Amazon Web Services Cloud Control API User Guide.
    ///   - identifier: The identifier for the resource. You can specify the primary identifier, or any secondary identifier defined for the resource type in its resource schema. You can only specify one identifier. Primary identifiers can be specified as a string or JSON; secondary identifiers must be specified as JSON. For compound primary identifiers (that is, one that consists of multiple resource properties strung together), to specify the primary identifier as a string, list the property values in the order they are specified in the primary identifier definition, separated by |. For more information, see Identifying resources in the Amazon Web Services Cloud Control API User Guide.
    ///   - patchDocument: A JavaScript Object Notation (JSON) document listing the patch operations that represent the updates to apply to the current resource properties. For details, see Composing the patch document in the Amazon Web Services Cloud Control API User Guide.
    ///   - roleArn: The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the  handlers  section of the resource type definition schema. If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials. For more information, see Specifying credentials in the Amazon Web Services Cloud Control API User Guide.
    ///   - typeName: The name of the resource type.
    ///   - typeVersionId: For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateResource(
        clientToken: String? = UpdateResourceInput.idempotencyToken(),
        identifier: String,
        patchDocument: String,
        roleArn: String? = nil,
        typeName: String,
        typeVersionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateResourceOutput {
        let input = UpdateResourceInput(
            clientToken: clientToken, 
            identifier: identifier, 
            patchDocument: patchDocument, 
            roleArn: roleArn, 
            typeName: typeName, 
            typeVersionId: typeVersionId
        )
        return try await self.updateResource(input, logger: logger)
    }
}

extension CloudControl {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: CloudControl, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension CloudControl {
    /// Return PaginatorSequence for operation ``listResourceRequests(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listResourceRequestsPaginator(
        _ input: ListResourceRequestsInput,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListResourceRequestsInput, ListResourceRequestsOutput> {
        return .init(
            input: input,
            command: self.listResourceRequests,
            inputKey: \ListResourceRequestsInput.nextToken,
            outputKey: \ListResourceRequestsOutput.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listResourceRequests(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results. The default is 20.
    ///   - resourceRequestStatusFilter: The filter criteria to apply to the requests returned.
    ///   - logger: Logger used for logging
    @inlinable
    public func listResourceRequestsPaginator(
        maxResults: Int? = nil,
        resourceRequestStatusFilter: ResourceRequestStatusFilter? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListResourceRequestsInput, ListResourceRequestsOutput> {
        let input = ListResourceRequestsInput(
            maxResults: maxResults, 
            resourceRequestStatusFilter: resourceRequestStatusFilter
        )
        return self.listResourceRequestsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listResources(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listResourcesPaginator(
        _ input: ListResourcesInput,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListResourcesInput, ListResourcesOutput> {
        return .init(
            input: input,
            command: self.listResources,
            inputKey: \ListResourcesInput.nextToken,
            outputKey: \ListResourcesOutput.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listResources(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: Reserved.
    ///   - resourceModel: The resource model to use to select the resources to return.
    ///   - roleArn: The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the  handlers  section of the resource type definition schema. If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials. For more information, see Specifying credentials in the Amazon Web Services Cloud Control API User Guide.
    ///   - typeName: The name of the resource type.
    ///   - typeVersionId: For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.
    ///   - logger: Logger used for logging
    @inlinable
    public func listResourcesPaginator(
        maxResults: Int? = nil,
        resourceModel: String? = nil,
        roleArn: String? = nil,
        typeName: String,
        typeVersionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListResourcesInput, ListResourcesOutput> {
        let input = ListResourcesInput(
            maxResults: maxResults, 
            resourceModel: resourceModel, 
            roleArn: roleArn, 
            typeName: typeName, 
            typeVersionId: typeVersionId
        )
        return self.listResourcesPaginator(input, logger: logger)
    }
}

extension CloudControl.ListResourceRequestsInput: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> CloudControl.ListResourceRequestsInput {
        return .init(
            maxResults: self.maxResults,
            nextToken: token,
            resourceRequestStatusFilter: self.resourceRequestStatusFilter
        )
    }
}

extension CloudControl.ListResourcesInput: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> CloudControl.ListResourcesInput {
        return .init(
            maxResults: self.maxResults,
            nextToken: token,
            resourceModel: self.resourceModel,
            roleArn: self.roleArn,
            typeName: self.typeName,
            typeVersionId: self.typeVersionId
        )
    }
}

// MARK: Waiters

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension CloudControl {
    /// Waiter for operation ``getResourceRequestStatus(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func waitUntilResourceRequestSuccess(
        _ input: GetResourceRequestStatusInput,
        maxWaitTime: TimeAmount? = nil,
        logger: Logger = AWSClient.loggingDisabled
    ) async throws {
        let waiter = AWSClient.Waiter<GetResourceRequestStatusInput, _>(
            acceptors: [
                .init(state: .success, matcher: try! JMESPathMatcher("progressEvent.operationStatus", expected: "SUCCESS")),
                .init(state: .failure, matcher: try! JMESPathMatcher("progressEvent.operationStatus", expected: "FAILED")),
                .init(state: .failure, matcher: try! JMESPathMatcher("progressEvent.operationStatus", expected: "CANCEL_COMPLETE")),
            ],
            minDelayTime: .seconds(5),
            command: self.getResourceRequestStatus
        )
        return try await self.client.waitUntil(input, waiter: waiter, maxWaitTime: maxWaitTime, logger: logger)
    }
    /// Waiter for operation ``getResourceRequestStatus(_:logger:)``.
    ///
    /// - Parameters:
    ///   - requestToken: A unique token used to track the progress of the resource operation request. Request tokens are included in the ProgressEvent type returned by a resource operation request.
    ///   - logger: Logger used for logging
    @inlinable
    public func waitUntilResourceRequestSuccess(
        requestToken: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = GetResourceRequestStatusInput(
            requestToken: requestToken
        )
        try await self.waitUntilResourceRequestSuccess(input, logger: logger)
    }
}
